<template>
  <LPainter ref="limePainter" isCanvasToTempFilePath pathType="url" @success="onSuccess" hidden useCORS />
</template>

<script>
import LPainter from '@/components/lime-painter/l-painter/l-painter'

export default {
  name: 'poster',
  components: { LPainter },
  mixins: [],
  props: {},
  data() {
    return {}
  },
  // 侦听属性
  watch: {},
  // 计算属性
  computed: {},
  // 监听页面加载，该钩子被调用时，响应式数据、计算属性、方法、侦听器、props、slots 已设置完成
  onLoad(options) {},
  // 监听页面显示，页面每次出现在屏幕上都触发
  onShow() {},
  // 监听页面初次渲染完成，此时组件已挂载完成
  onReady() {},
  // 下拉刷新
  onPullDownRefresh() {},
  // 加载更多
  onReachBottom() {},

  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    // ...mapActions([]),

    // 设置海报渲染模板
    async setPosterTemp(posterJson) {
      this.$refs.limePainter.render(posterJson)
    },

    // 绘制完成回调
    onSuccess(e) {
      this.$emit('onSuccess', e)
    },
  },
}
</script>

<style lang="scss" scoped></style>
